Imports FetchXML
Imports FetchXMLBuilder.MetadataServiceSdk

Public Class frmAttributeProperty

    Private Att As Attribute

    Friend Sub New(ByVal Attribute As Attribute)
        InitializeComponent()
        Att = Attribute
    End Sub

    Private Sub frmAttributeProperty_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.txtAlias.Text = Me.Att.AttributeAlias
        Me.lstAggregate.SelectedIndex = Me.lstAggregate.FindStringExact(Me.Att.Aggregate)
    End Sub

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.DialogResult = Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
        Me.DialogResult = Windows.Forms.DialogResult.OK
        Att.AttributeAlias = Me.txtAlias.Text
        If Me.lstAggregate.SelectedIndex = -1 Then
            Att.Aggregate = ""
        Else
            Att.Aggregate = Me.lstAggregate.SelectedItem.ToString
        End If
    End Sub

End Class